<!--
*@Author: QWP
*@Description: 用于手机端的文档在线编辑
*@Date: 2025-02-25 14:22:06
-->
<template>
  <div class="u-app-office-editor"
    :style="style">
    <u-doc-editor :current="params"/>
  </div>
</template>

<script lang='ts' setup>
import { ref, reactive, computed, onMounted } from 'vue' 
import { useLoginStore } from '@/store'

const loginStore = useLoginStore()

const style = reactive({
  width: `${window.innerWidth}px`,
  height: `${window.innerHeight}px`,
})

const params = ref<object>({})
const getParams = () => {
  params.value = {};
  let locations: string[] = (window.location['href'] || '').split('?');
  if(locations.length > 1) {
    (locations['1'] || '').split('&').forEach(item => {
      let tIs = item.split('=');
      params.value[tIs[0]] = tIs.length > 1 ? tIs[1] : '';
      if(params.value['token']) {
        loginStore.setToken(params.value['token'])
      }
    })
  }
}

onMounted(() => {
  getParams()
})
 
</script>

<style lang='scss' >
@media (max-width: 600px) {
  html,body {
    min-width: unset !important;
  }
}
.u-app-office-editor {
  position: absolute;
  left: 0;
  top: 0;
}
</style>